/*
R * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.hera.process.workflow.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

import com.hera.base.domain.BaseDomain;
import com.hera.process.config.domain.Department;
import com.hera.process.config.domain.ParameterDetail;
import com.hera.process.security.domain.User;

/**
 *
 * @author cmontes
 */
@Entity
@Table(name = "STAGE_USER")
public class StageUser extends BaseDomain implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "StageUser")
    @TableGenerator(name = "StageUser", table = "sequence", pkColumnName = "seq_name", valueColumnName = "seq_id", pkColumnValue = "STAGEUSER", allocationSize = 1)
    @Column(name = "ID_STAGE_USER")
    private Long idStageUser;
    @JoinColumn(name = "ID_STAGE", referencedColumnName = "ID_STAGE")
    @ManyToOne
    private Stage stage;
    /*
    @Column(name = "ID_USER")
    private Long idUser;
    @Column(name = "ID_PROCESS_GROUP")
    private Long idProcessGroup;
    @Column(name = "ID_DEPARTMENT")
    private Long idDepartment;*/
    @ManyToOne
    @JoinColumn(name="ID_USER")
    private User user;
    @ManyToOne
    @JoinColumn(name="ID_PROCESS_GROUP")
    private ProcessGroup processGroup;
    @ManyToOne
    @JoinColumn(name="ID_DEPARTMENT")
    private Department department;
    @ManyToOne
    @JoinColumn(name="ID_TYPE")
    private ParameterDetail type;
    @Column(name = "PRIORITY")
    private Integer priority;
    
    public StageUser() {
    }

    public StageUser(Long idStageUser) {
        this.idStageUser = idStageUser;
    }
    
    public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public ProcessGroup getProcessGroup() {
		return processGroup;
	}

	public void setProcessGroup(ProcessGroup processGroup) {
		this.processGroup = processGroup;
	}

	public Department getDepartment() {
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

	public ParameterDetail getType() {
		return type;
	}

	public void setType(ParameterDetail type) {
		this.type = type;
	}

    public Long getIdStageUser() {
        return idStageUser;
    }

    public void setIdStageUser(Long idStageUser) {
        this.idStageUser = idStageUser;
    }

    public Stage getStage() {
        return stage;
    }

    public void setStage(Stage stage) {
        this.stage = stage;
    }
       

    public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	@Override
    public int hashCode() {
        int hash = 0;
        hash += (idStageUser != null ? idStageUser.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof StageUser)) {
            return false;
        }
        StageUser other = (StageUser) object;
        if ((this.idStageUser == null && other.idStageUser != null) || (this.idStageUser != null && !this.idStageUser.equals(other.idStageUser))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.hera.process.data.domain2.StageUser[ idStageUser=" + idStageUser + " ]";
    }
    
}
